package com.example.team6.controller;


import com.example.team6.entity.Comment;
import com.example.team6.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author team6
 * @since 2020-09-10
 */
@RestController
@CrossOrigin
//@RequestMapping("/team6/comment")
public class CommentController {

    @Autowired
    CommentMapper commentMapper;

    @PostMapping(value = "api/getcomment")
    @ResponseBody
    public List<Comment> getcomment (@RequestBody Comment requestUser){

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("courseid", requestUser.getCourseid());
        List<Comment> commentList = commentMapper.selectByMap(map);

        return commentList;
    }
}

